home *** CD-ROM | disk | FTP | other *** search
/ Agent Central Host Computer / Agent - Central Host Computer.iso / _SETUP.1 / vprevinsert.sql < prev    next >
Text File  |  2000-05-12  |  756b  |  21 lines

  1. /*
  2. This view determines the most recent previous insert date and time for a given cashbox into a particular farebox.
  3. */
  4. create or replace view vprevinsert as
  5. select vcurstaterange.conversion_num, 
  6.     vcurstaterange.farebox_glid,
  7.     vcurstaterange.close_count,
  8.     vcurstaterange.cashbox_glid,
  9.     vcurstaterange.conv_date, 
  10.     cbinsert.conv_date insert_date
  11. from vcurstaterange, cbinsert
  12. where vcurstaterange.farebox_glid = cbinsert.farebox_glid and
  13.     cbinsert.cashbox_glid = vcurstaterange.cashbox_glid and
  14.     cbinsert.conv_date = (select max(cbi2.conv_date) 
  15.                 from cbinsert cbi2 
  16.                 where cbi2.conv_date < vcurstaterange.conv_date and
  17.                 cbi2.cashbox_glid = cbinsert.cashbox_glid and            
  18.               cbi2.farebox_glid = vcurstaterange.farebox_glid);
  19.  
  20.  
  21.